回 帖 发 新 帖 刷新版面

主题:js 的变量怎么写到HTML里?

我希望通过 <select name="BigClassName" onChange="changeselect1(this.value)">
选择一个值改变 <iframe ID="editor" src="edit.asp?ArticleID=<%=mbid%>" frameborder=0 scrolling=no width="620" height="405"></iframe>中mbid的值

function changeselect1(locationid)
{
     for (i=0;i<subval2.length;i++)
     {
         if (subval2[i][1] == locationid)
         {
         mbid=subval2[i][2];
         }
     }
}

应该怎么写呢?

回复列表 (共5个回复)

沙发

<form name="form1">
  <select name="BigClassName" onChange="changeselect1()">
  <option value="http://www.google.com">google</option>
  <option value="http://www.sina.com.cn">新浪</option>
  <option value="http://www.baidu.com">百度</option>
  </select>
 </form>
 <iframe ID="editor" src="http://www.google.com" frameborder=0 scrolling=no width="620" height="405"></iframe>
 <script>
function changeselect1(locationid)
{
    v=document.form1.BigClassName.value;
     for (i=0;i<v.length;i++)
     {
         if (document.form1.BigClassName.options[i].selected==true)
         {
           document.getElementById("editor").src=document.form1.BigClassName.options[i].value;
         }
     }
}
</script>
是不是这个

板凳

谢谢拉  就是这样 哈哈 高手

3 楼

大哥不行啊 5555555555555555555555555

4 楼

<select name="BigClassName" onChange="changeselect1()">
<%
count1 = 0
do while not rs.eof
%>
<option value="edit.asp?ArticleID=<%=rs("id")%>"><%=trim(rs("title"))%></option>
<%
count1 = count1 + 1
rs.movenext
loop
rs.close
%>
</select>

5 楼

你想通过客户端更改服务端变量?那不可能啊.必须提交表单.然后在服务端判断就行了.

我来回复

您尚未登录,请登录后再回复。点此登录或注册