在网页上包含不显眼的信息的最佳方式 [英] Best way to include unobtrusive information on a web page

查看:95
本文介绍了在网页上包含不显眼的信息的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一些我写的脚本在我的页面上设置了Google地图。这些脚本包含在我的页面的< head> 中,并使用jQuery来构建地图,并使用页面上的地址列表生成标记。



然而,我有一些确切的坐标数据,每个地址都需要javascript来正确放置标记。这不是我希望在屏幕上向用户显示的信息,那么将该数据放入我的文档中的最佳实践方式是什么? 解决方案方案

我不会推荐使用style来隐藏某些东西,它会显示在没有(或禁用)css suppor的浏览器中,并且看起来很奇怪。



你可以将它存储在一个javascript变量中,或者添加一个隐藏值如
的表单(在一个未使用的表单中确认它是否有效):

 < form action =#method =getid =myHiddenValues> 
< input type =textname =hiddenval1id =hiddenval1value =1234/>
< input type =textname =hiddenval2id =hiddenval2value =5678/>
< / form>

您可以从javascript读取和更新。


So I've got some scripts I've written which set up a Google map on my page. These scripts are in included in the <head> of my page, and use jQuery to build the map with markers generated from a list of addresses on the page.

However, I have some exact co-ordinate data for each address which the javascript requires to place the markers correctly. This isn't information I want to be visible on the screen to the user, so what's the "best practice" way to put that data into my document?

解决方案

I would not reccomend using style to hide something, it will show up in browsers without (or with disabled) css suppor and look strange.

You could store it in a javascript variable or add a form with hidden values like this (inside an unused form to be sure it validates):

<form action="#" method="get" id="myHiddenValues">
   <input type="text" name="hiddenval1" id="hiddenval1" value="1234"/>
   <input type="text" name="hiddenval2" id="hiddenval2" value="5678"/>
</form>

wich you can read and update from javascript.

这篇关于在网页上包含不显眼的信息的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆