?
Solved

vbscript setting innerHTML

Posted on 2010-09-08
4
Medium Priority
?
2,871 Views
Last Modified: 2012-08-13
I've been led to believe that vbscript can access the DOM but keep getting a message:

Microsoft VBScript runtime error '800a01a8'  - Object required: ''

Have tried the attached code but it no good.






<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<body>
<table>
  <tr>
     <td><span id="celldiv1"></span></td>

  </tr>
</table>
<%
'set obj1 = document.GetElementByID("celldiv1")
'obj1.innerHTML = "something"
document.getElementById("celldiv1").innerHTML = "something"
 %>
</body>
</html>

Open in new window

0
Comment
Question by:chris_desborough
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 33632196
That's VBscript for ASP on the server.  VBscript in the browser uses script tags.  This page gives some examples: http://www.herongyang.com/VBScript/IE-Browser-VBScript-Support-Introduction.html  The first example works in IE6.  Remember that VBscript only works in IE.
0
 
LVL 3

Expert Comment

by:Marbleman
ID: 33632222
You are mixing something up here:

You cannot access the DOM from ASP code... it is executed on the the server!


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'this runs on the server, before the code is delivered to the browser
test="something"

%>
<script language="javascript" >

//this runs on the client (browser)
function changeText(){
document.getElementById("celldiv1").innerHTML = "something new";
}

</script>
<body>
<table>
  <tr>
     <td onclick="changeText()"><span id="celldiv1"><% = test %></span></td>

  </tr>
</table>

</body>
</html>

Open in new window

0
 
LVL 11

Assisted Solution

by:govindarajan78
govindarajan78 earned 500 total points
ID: 33637023
<%@LANGUAGE="VBSCRIPT"%>

<body>
<table>
  <tr>
     <td><span id="celldiv1"></span></td>

  </tr>
</table>
<script type="text/javascript">
document.getElementById("celldiv1").innerHTML = "<%response.write("something")%>"
 </script>
</body>
</html>
0
 
LVL 1

Author Closing Comment

by:chris_desborough
ID: 33666699
Thanks all. Both of your suggestions pointed me in the right direction.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question