[英]I am having 2 divs in html index page. Inside each div i need to call one function from js file
[英]I have a JS file which is accepting value from a HTML page. I have to use this variable inside a CSS embedded inside the JS
我正在使用simplemaps ,这是一个js文件,其中的函数用于从HTML页面获取值。
Javascript功能
function getValue(intvalue){
alert(intvalue);
var mapval = intvalue;
}
var simplemaps_worldmap_mapdata = {
main_settings:{
//General settings
width:1004,
background_color: '#FFFFFF',
background_transparent: 'no',
border_color: '#FFFFFF',
zoom: 'yes',
pop_ups: 'detect', //on_click, on_hover, or detect
//Country defaults
state_description: 'Country description',
state_color: '#88A4BC',
state_hover_color: '#3B729F',
state_url: 'http://simplemaps.com',
all_states_inactive: 'no',
//Location defaults
location_description: 'Location description',
location_color: '#FF0067',
location_opacity: 1,
location_url: 'http://simplemaps.com',
location_size: 35,
location_type: 'circle', //or circle
all_locations_inactive: 'no',
url_new_tab: 'no',
initial_zoom: 1,
initial_zoom_solo: 'no',
auto_load: 'yes',
hide_labels: 'no'
},
}//end of simplemaps_worldmap_mapdata
我必须将值动态传递给“初始缩放”颜色字段。 以不同的值将图像缩放到不同的级别。
我不明白您到底要问什么,但我想您需要访问main_settings对象
您可以通过以下方式访问对象中的属性
simplemaps_worldmap_mapdata.main_settings.initial_zoom
和
simplemaps_worldmap_mapdata["main_settings"]["initial_zoom"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.