Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Maximum ASP
  Ads  
 


  Sponsors  

Meet Our Sponsors

R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
Verndale
The Official Microsoft ASP.NET Website
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  HTML / Text Mo...  Running Javascript in text/html module
Previous Previous
 
Next Next
New Post 1/11/2006 9:42 AM
User is offline joe schmoe
11 posts
10th Ranked


Running Javascript in text/html module 
Hi,

  I'm trying to run some javascript inserted into the text/html module but the script won't work.  I tested the script outside of the DotNetNuke environment and it works fine.  It is only when I insert it into the DotNetNuke test/html module that it won't work.  Any assistance is most appreciative.
 
New Post 1/11/2006 12:02 PM
User is offline Jon Henning
1625 posts
www.codeendeavors.com
5th Ranked










Re: Running Javascript in text/html module 
Without seeing the script it is hard to say, but most likely your issue is in the referencing of elements on the page by id, which in a framework such as DNN which uses usercontrols causes the ids to change (be prefixed) to guarantee uniqueness.  See this post for more info.
 
New Post 1/13/2006 8:07 AM
User is offline joe schmoe
11 posts
10th Ranked


Re: Running Javascript in text/html module 

 Jon Henning wrote
Without seeing the script it is hard to say, but most likely your issue is in the referencing of elements on the page by id, which in a framework such as DNN which uses usercontrols causes the ids to change (be prefixed) to guarantee uniqueness.  See this post for more info.

 

Hi thanks for the tip, but it still won't work.  Here is the original code that works outside of DotNetNuke.

<SCRIPT LANGUAGE="JavaScript">
    <!-- Hide JavaScript from Java-Impaired Browsers

   function calculate() {
    var Stack1 = 0,Stack2 = 0,Stack3 = 0,Stack4 = 0;
    Stack1 = ((document.FWform.AL1.value * document.FWform.AW1.value * document.FWform.AH1.value)/1728)/128;
    Stack2 = ((document.FWform.AL2.value * document.FWform.AW2.value * document.FWform.AH2.value)/1728)/128;
    Stack3 = ((document.FWform.AL3.value * document.FWform.AW3.value * document.FWform.AH3.value)/1728)/128;
    Stack4 = ((document.FWform.AL4.value * document.FWform.AW4.value * document.FWform.AH4.value)/1728)/128;
    document.FWform.CordsDelivered.value = Math.round((Stack1 + Stack2 + Stack3 + Stack4)*100)/100;
    document.FWform.AmountShort.value = Math.round((document.FWform.AmtOrdered.value - document.FWform.CordsDelivered.value)*100)/100;
    document.FWform.Overcharge.value = Math.round((document.FWform.AmountShort.value * document.FWform.CostCord.value)*100)/100;
   }
 
    // End Hiding -->
    </SCRIPT>

    <form name="FWform">
   
      <ul>
        <font size = "4">
        <li>Take at least three measurements for each dimension to get an average.</li>
        <li>Input averages in appropriate box for each stack.</li>
        <li>Click the &quot;Calculate&quot; button to get the total number of cords and dollar amount short.</li>
        <li>To file a complaint or for more information call Butte County Weights &amp; Measures at 891-2756.</li>
        </font>
      </ul>
     
      <hr>
 
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <th width="50%" height="35"><p align="center">Number of Cords Ordered:</th>
          <th width="50%" height="35"><p align="center">Cost per Cord:</th>
         
        </tr>
        <tr>
          <td width="50%" height="35"><p align="center"><input type="text" name="AmtOrdered" size = "10"></td>
          <td width="50%" height="35"><p align="center"><input type="text" name="CostCord" size="10"></td>
        </tr>
      </table>
 
      <hr>

      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td width="25%" height="35"></td>
          <th width="25%" height="35" align="center">Average Width in Inches</th>
          <th width="25%" height="35" align="center">Average Height in Inches</th>
          <th width="25%" height="35" align="center">Average Length in Inches</th>
        </tr>
        <tr>
          <th width="25%" height="35" align="right">Stack 1</th>
          <td width="25%" height="35"><p align="center"><input type="text" name="AW1" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AH1" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AL1" size="10"></td>
        </tr>
        <tr>
          <th width="25%" height="35" align="right">Stack 2</th>
          <td width="25%" height="35"><p align="center"><input type="text" name="AW2" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AH2" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AL2" size="10"></td>
        </tr>
        <tr>
          <th width="25%" height="35" align="right">Stack 3</th>
          <td width="25%" height="35"><p align="center"><input type="text" name="AW3" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AH3" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AL3" size="10"></td>
        </tr>
        <tr>
          <th width="25%" height="35" align="right">Stack 4</th>
          <td width="25%" height="35"><p align="center"><input type="text" name="AW4" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AH4" size="10"></td>
          <td width="25%" height="35"><p align="center"><input type="text" name="AL4" size="10"></td>
        </tr>
      </table>

      <hr>

      <p align="center"><input type="button" value="Calculate" name="Calculate" onClick="calculate();"></p>

      <hr>

      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <th width="33%" height="35">Number of Cords Delivered</th>
          <th width="33%" height="35">Amount Short</th>
          <th width="34%" height="35">Dollar Overcharge</th>
        </tr>
        <tr>
          <td width="33%" height="35"><p align="center"><input type="text" name="CordsDelivered" size="10"></td>
          <td width="33%" height="35"><p align="center"><input type="text" name="AmountShort" size="10"></td>
          <td width="34%" height="35"><p align="center"><input type="text" name="Overcharge" size="10"></td>
        </tr>
      </table>

    </form>

I would appreciate it if anyone could help me out.  Thanks.

 
New Post 1/13/2006 9:25 AM
User is offline Jon Henning
1625 posts
www.codeendeavors.com
5th Ranked










Re: Running Javascript in text/html module 

Are you pasting the entire contents of this post into your html module?  Including the form tag?  If so, this is most likely your issue.  DNN already defines a form tag and by putting this in your module you will have nested form tags.  I suggest taking out your form tag and replace your script references to the objects...

Either specify IDs on all your elements (make them the same as your name attribute) and change things like this

document.FWform.AL1.value

to

document.getElementById('AL1').value

Or simply change this

document.FWform.AL1.value

to

document.forms[0].AL1.value

but still remove the form tag.

 


 
New Post 1/19/2006 1:55 PM
User is offline joe schmoe
11 posts
10th Ranked


Re: Running Javascript in text/html module 
I wasn't sure if DotNetNuke was already using forms or not.  Thanks for all your assistance.  That did the trick.
 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  HTML / Text Mo...  Running Javascript in text/html module
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Convert Visitors to Customers
In order to bring value to your users, we must first understand them. VIVIDSITES will help you build a custom web application and interactive marketing tools that your users will thank you for. We marry high-end creative with head banging technology to entertain and convert visitors into paying customers. Call 314.514.0505 or visit us at http://www.vividsites.com to find out how.
- V I V I D S I T E S -
Gearworx Web Hosting
As a premier provider of Web Hosting, Private/White Label hosting, Server Colocation, Dedicated Server, and other Managed Services, Gearworx offers an array of services designed to more effectively manage strategies driving businesses on the Web. Headquartered in Fremont, California our state of the art tier one data centers and distributed managed services environment enables Gearworx to offer your business enterprise level solutions through simplified processes.
Gearworx Web Hosting
Glanton: Enterprise Intranet Specialists Using DNN
Glanton Solutions are a premier provider of sevices for large corporates lloking to outsource Intranet sites.
www.glanton.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP