Running javascript with HTML

Hi all,
I am looking for a way and example of how to run javascript against an HTML file. My project is a web site test utility that can load HTML pages and submit forms, however some forms require executing javascript to set or validate various form fields. I've looked into the Rhino javascript engine, but I do not understand how to execute the javascript functions which change HTML form values. Can anyone give examples of how this can be done? Please let me know if I need to explain this further.
Thanks!

Sorry the description of what I am doing is a bit vague. My java application is like a web crawler, no web browser involved, but it needs to behave like a web browser. The application will parse html and follow links found in anchor HTML tags. When my app encounters a form, it can build the target URL by parsing the form action, and all form elements such as the input, select and whatnot. The tricky part is when forms involve javascript that may alter values in form input fields, for example, hidden input fields. In this case, my app cannot simply build the target URL combining form field values. My application must execute any found javascript functions so that the correct values are placed in the form fields, then the true URL can be built. I investigated the Rhino javascript engine, which seems great for executing javascript methods, but I cannot find how to include form fields in the HTML which the javascript function may alter. I'm not set on using Rhino, just anything that works.

Similar Messages

  • Javascript with Html-db (Apex)

    Hi everybody,
    My function is :
    <script language="JavaScript1.1" type="text/javascript">
    function desactiverElement(testString,item1,item2)
    { theTest= eval(testString);
    if(theTest)
    for (var i=1;i<4;i++)
    if (arguments)
    disItem = document.getElementById(arguments[i]);
    disItem.style.background = '#C0C0C0';
    disItem.disabled = true;
    else
    disItem = document.getElementById(arguments[i]);
    disItem.disabled = false;
    </script>
    on the page HTML Header, I put:
    OnLoad="javascript: desactiverElement(('document.getElementById(\'P32_ID_FEUILLET\').value != \'\'','P32_ID_FEUILLET','P32_NEQ');"
    It works. It works also when I refresh my page.
    But , when I click on my « create » button, my page is appears with the new data but my field are not still disable = false it comes enable.
    Can someone help me ?
    Thanks. Bye.

    Thank you very much Scott,
    It was my Character set of file that was set to Unicode. I change it to European.... and it works.
    I put my application "27331 - Feuillets" on dkubicek shema. My Onload is on page 32.
    I have some problem creating my tables. I have this message:
    ORA-01658: unable to create INITIAL extent for segment in tablespace FLOW_8897
    Thanks. Bye.

  • Running Apache with html files on a mounted NAS device

    Hi.  I am hoping someone could help me out.  I have been pulling my hair out for the past 2 days.
    I am running Arch v0.8.  I have very few packages installed -- I started with base install and added Apache, MySql, PHP, Samba and a few others.
    Configuration:
    - I have apache running as user=apache, group=apache.  I changed this from nobody:nobody in httpd.conf.
    - I have a Buffalo TerraStation on my lan.  It is called edge_nas.  It has a share called "linux".
    - I successfully mounted the Buffalo share using the following entry in fstab:
    //edge_nas/linux /mnt/edge_nas smbfs username=apache,password=theapachepassword,gid=apache 0 0
    - I created a soft link in /home which points /home/httpd to /mnt/edge_nas/home/httpd.
    - I want my web files on the Buffalo NAS device because it is raid 5. 
    Problem:
    - Root is able to read and write anywhere on /mnt/edge_nas.
    - Apache can read /mnt/edge_nas.
    - Apache can write in its home directory on /mnt/edge_nas/home/apache.
    - Apache cannot write in any other directory (especially /mnt/edge_nas/home/httpd/html).
    Question:
    - How do I grant apache read/write access to the html root?
    Any ideas?  Please be gentle.
    Thank you for your help.
    Edge

    cactus wrote:umm. still not clear on what you did...
    Please layout a clear step by step of what you did. That might make it easier to help you.
    Ok. From the top...
    On the Buffalo NAS (edge_nas):
    - I logged into the Buffalo web-based admin screen.
    - I created a new share called linux.
    - I created a new user called apache.
    - I granted read/write access to apache on the linux share.
    On Arch Linux:
    - I logged in locally as root.
    - I created a new user apache, in group apache.
    - I created a new directory called /mnt/edge_nas.
    - I mounted the Buffalo share using the following entry in fstab:
    //edge_nas/linux /mnt/edge_nas smbfs username=apache,password=theapachepassword,gid=apache 0 0
    - I changed apache to run as apache:apache.  I changed this from nobody:nobody in httpd.conf.
    - In /home/httpd, I created a softlink for /home/httpd/html, pointing it to /mnt/edge_nas/home/httpd/html.
    - I chmod 777 /mnt/edge_nas/home/httpd/html.
    - I restarted apache.
    - I created a summy index.html in that directory to ensure apache can see the mount.
    To test it out:
    - I logged into arch locally as my apache user.
    - I cd'ed to /home/httpd/html.
    - I tried to create a new text file with vi.
    - I cannot open the text file for write.
    I hope that helps.  Please excuse any misuse of terminology.
    Thanks.
    Edge

  • Running JMX with HTML adapter

    Hi!
    I am new to JMX MBeans and I'm trying to run a simple sample program with HtmlAdaptorServer. I have three .java files, one with the interface, on with the class having its implementation and a main .java file to register with the server..etc.
    I am able to compile the 3 files without any error but while running, it gives me the following exeption:
    Exception in thread "main" java.lang.NoClassDefFoundError:
    HelloAgent (wrong name:com/example/mbeans/HelloAgent)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    Can someone please help me as to where am I goin wrong?
    -Kanak

    Kanak10 wrote:
    hi!
    I have the same, a com, then example, mbean and inside it HelloAgent.java.That's not what I've been describing. Almost, but not entirely. Check what I wrote above.
    But how do I exactly set the classpath? should it be an environment variable?Sorry, but if you don't know that, then you must keep away from JMX for some time and go back to the basics.
    See this and this.

  • How to create and use Data Vault with HTML/JavaScript (SAPUI5) for Mobile Apps?

    Hello,
    I am creating a demo Enterprise Mobile App, for cross platform and I want to use the Data Vault.
    I am not able to figure out how to implement the Data Vault with HTML/JavaScript i.e. SAPUI5 for cross platform mobile apps I have a tutorial, but it is for Android based apps. Where as I want it for iOS as well. I guess, in this case, implementing the Data Vault using SAPUI5 over HTML and JavaScript would be  better.
    If anyone has any links or sample code to implement Data vault in HTML/JavaScript (SAPUI5) or specific for iOS apps, it would be great.
    Thank you.

    Hi,
    This is the "SAP Mobile Documents" community, so this seems to be the wrong place for asking your question related to Data Vault / SAPUI5.
    Maybe you should post your question here: http://scn.sap.com/community/developer-center/front-end.
    best regards,
    Ingo

  • Javascript and html menu to be used with ADF/JSF using JDeveloper

    I have a menu for a webpage that was originally built using html and javascript. I need to convert it to be used with JSF and ADF. In the html, the menu items used an unordered list inside of a div tag.
    It looks something like this:
    <!--<div id="shademenu" class="shadetabs">
    <ul>
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
    <li>Item4</li>
    <li>Item5</li>
    <li>Item 6</li>
    </ul>
    </div> -->
    AND
    the submenu(s) have links that look something like:
    <!--<div id="dropmenu0" class="dropmenudiv">
    Data
    Data
    Data
    </div>-->
    It is unclear to me how to work with my javascript menu to get the same look and feel with JSF or ADF as I did with html. Any insights would be great. Thanks.
    Daniel
    Message was edited by:
    dannyc

    Hello,
    If you do not find any existing JSF component (in ADF Faces/Trinidad, or any other JSF library) you can for sure extend/create your own component with specific renderer that will be the HTML/Javscript that you want.
    So here some interesting pointers about the subject:
    - Buildin Custom JSF component (Chris Schalk)
    - Build Custom JSF Components) (Jonas Jacobi
    - Extending Default Render (and lot of other JavaEE blueprints)
    These links will give you a starting point.
    Regards
    Tugdual Grall

  • How can I use javascript in a Text Area with HTML editor??

    My question is... how can I use javascript in Text Area with HTML editor??
    I can use javascript functions that change the content of Text Areas but i can´t if i try in text area with html editor....
    I need to limit number of characters in a text area with html editor and i can´t.
    could anybody help me please?

    I have been experiencing similar problems with the HTML Editor and have managed to find an answer that should start to answer some of my questions. The Apex HTML Editor Standard is actually an HTML editor called FCKeditor. The FCKeditor has a Javascript API that can be found at http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API. Unfortuately this doesn't seem to give the whole answer and I found more at http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49607.
    I needed to get the text entered within my html editor standard (e.g. P1_MYTEXT) and use it within my javascript function. I did this by using the following script
    <script language="JavaScript" type="text/javascript">
    function showtext(){
    var oEditor = FCKeditorAPI.GetInstance('P1_MYTEXT');
    var editortext = escape(oEditor.GetXHTML(oEditor.FormatOutput));
    alert(editortext);
    </script>
    Hope this helps.
    Matthew

  • Use of javascript and textarea with HTML editor

    Hi all,
    I have been trying to use some onchange javascript in the HTML Form Element Attributes of an item which is a textarea with an HTML Editor. It just seems to ignore the code. When you "view source" the code does not seem to be there.
    What I am attempting to do is described in thread: detecting changes to items prior to submitting page
    i.e. to warn a user that if they leave the page without saving they will lose their changes. It works fine with most of the other items on the page i.e. text boxes, select lists but not the textarea with html editor.
    Is there somewhere else I should be putting my js for items of this type? I have spent some time looking through the forum posts but cannot find an answer so far.
    Thanks,
    Brian

    I'm having the same problem.
    Would like to use the onChange event in a textarea with html editor.
    This works in Firefox (where I don't get the html editor but only a textarea) but doesn't seem to work in IE.
    Is there another way of detecting the user has changed the text in the html editor?
    Thanks,
    Pieter

  • JavaScript Image Rollover with html:image ?

    I've got a website I'm developing in which I have a submit button as well as a button which pops up a google map within my web page. I've currently got the buttons working and doing what they are supposed to do, but I'm having trouble with a rollover image effect.
    The method I'm currently using looks something like...
    For my page with the submit button:
    <html:image src="images/spacer.gif" styleId="sButton">
    </html:image>
    For my page with the button that pops up a google map:
    <html:image src="images/spacer.gif" styleId="mButton" onclick="javascript:blahblahblah">
    </html:image>That's what I'm using to display the buttons on both pages and the functionality works. Next up is the basic CSS I'm using for the image rollover effect...
    For the submit button...
    #sButton {
    display:block;
    width:100px;
    height:100px;
    background-image:url(submitImage.jpg);
    background-repeat:no-repeat;
    #sButton:hover, #sButton:active {
    background-image:url(submitImageHover.jpg);
    background-repeat:no-repeat;
    For the map button...
    #mButton {
    display:block;
    width:100px;
    height:100px;
    background-image:url(mapImage.jpg);
    background-repeat:no-repeat;
    #mButton:hover, #mButton:active {
    background-image:url(mapImageHover.jpg);
    background-repeat:no-repeat;
    }And that's basically it. So as you can see, I'm using the <html:image> to give myself a submit button type thing which works perfectly in both cases. To try and make it have a rollover image effect I'm setting a styleId and then in my CSS declaring a default image and then a hover/active image. Back in the <html:image> tag, for the required src attribute, I've just got a spacer.gif which is a 1 x 1 image that is 100% transparent.
    The effect, at least in the Gecko based browsers I've tried, such as Firefox, is that you don't see the spacer.gif even though it is there, and all you see are the CSS background images which changes on hover. This even works in IE7.
    My problem... Internet Explorer browsers prior to 7 aren't doing the image rollover. The buttons still work, but I can't get the image to change just using the CSS... Any tips on a way to still use this method or to still use <html:image> but to use some sort of javascript solution?

    Thanks for all the quick help on this one... I got it to work just like I was hoping.
    bodhi-firestarr... You got me thinking and so I went and tried to search for a way to use that particular javascript method with the <html:image> tag. This brought me to the solution that I could use styleId just like an id and then getElementById in the javascript.
    Unfortunately, this only partially solved my problem... It made the submit button work through both CSS and JavaScript, but my map it button still wasn't working. My map button is inside of a loop generating a button for a set of results. If I used the getElementById method it would use the same id for each one causing problems. When I tried to add some sort of index to the end of the Id to fix this, it messed up my CSS, but that's when...
    gmachamer, you came up with just the solution I needed. I had no idea property actually translated to name. Once I knew this I was able to use property and got everything to work.
    Thanks again everyone!

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

  • Replacing non-ASCII characters with HTML charcter references

    Hi All,
    In Oracle 10g or greater is there a built-in function that will convert a string with non-ASCII characters like this
    a b č 뮼
    into an ASCII string with HTML character references like this?
    a b & # x 0 1 0 D ; & # x B B B C ;
    (note I had to include spaces between each character in the sample code for message to prevent the forum software from converting my text)
    I tried using
    utl_i18n.escape_reference( val, 'us7ascii' )
    but for some reason it returns
    a b c & # x B B B C ;
    Note how it converted the Western European character "č" to its unaccented counterpart "c", not "& # x 0 1 0 D ;" (is this a bug?).
    I also tried a custom solution using regexp_replace and asciistr (which I can't include here because the forum software chokes on it) but it only returns the correct result for values <=4000 characters long. Unfortunately asciistr doesn't appear to accept CLOB values larger than 4000 characters. It returns an error message like
    (ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 30251, maximum: 4000) ).
    I'm looking for a solution that works on CLOB data of any size.
    Thanks in advance for any insight you can provide.
    Joe Fuda

    So with that (UTF8) in mind, let's take another look.....
    As shown below, I used a AL32UTF8 database.
    Note: I did not use a unicode capable tool for querying. So I set console mode code page to 1250 just to have č displayed properly (instead of posing as an è).
    Also, as a result of using windows-1250 for client character set, in the val column and in the second select's ncr column (iso8859-1), è (00e8) has been replaced with e through character set conversion going from server back to client.
    Running the same code on a database with a db character set such as we8mswin1252, that doesn't define the č (latin small c with caron) character, would yield results with a c in the ncr column.
    C:\>chcp 1250
    Aktuell teckentabell: 1250
    C:\>set nls_lang=.ee8mswin1250
    C:\>sqlplus test/test
    SQL*Plus: Release 11.1.0.6.0 - Production on Fri May 23 21:25:29 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the OLAP option
    SQL> select * from nls_database_parameters where parameter like '%CHARACTERSET';
    PARAMETER              VALUE
    NLS_CHARACTERSET       AL32UTF8
    NLS_NCHAR_CHARACTERSET AL16UTF16
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'us7ascii') NCR from dual;
    VAL  NCR
    č e  c e
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'we8iso8859p1') NCR from dual;
    VAL  NCR
    č e  &# x10d; e     <- "è"
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'ee8iso8859p2') NCR from dual;
    VAL  NCR
    č e  č &# xe8;
    SQL> select unistr('\010d \00e8') val, utl_i18n.escape_reference(unistr('\010d \00e8'),'cl8iso8859p5') NCR from dual;
    VAL  NCR
    č e  &# x10d; &# xe8;In the US7ASCII case, where it should be possible for all non-ascii characters to be escaped, it seems as if the actual escape step is skipped over.
    Hope this helps to understand whether utl_i8n is usable or not in your case.
    Message was edited by:
    orafad
    Fixed replaced character references :)

  • Is there a way to run javascript in the url in FF6?

    With the introduction of scratchpad to FF6 the javascript in the url is filtered out and will not execute.
    The only way i have been able to run js scripts is to use the scratchpad even if it's a one line thing that i need.
    I went into about:config and typed javascript into the filter then changed the browser.urlbar.filter.javascript configuration from true to false, nothing changed.

    Running javascript: in the urlbar is no longer supported in version 6 for security reasons. Users were installing malware. Please use the scratchpad.

  • Javascript with PL/Sql

    Hi everyone,
    I want to know if it's a good idea to use javascript with PL/sql using HTML-DB (PL) (enabled and disabled button) ?
    Thank you very much. Bye.
    Eric

    I would suggest you pay attention to the base directory where the relative paths for @src and @href make pertinent value pointing to the desired resource.

  • Run javascript (not in a jsx file) from the command line extendscript

    Hi all,
    I was wondering if anyone knew how to run javascript from the command line in Extendscript (meaning Extendscript would be the target application). I know about the -run command line flag in which allows you to run a .jsx script from the command line but what I'm looking for similar syntax to run a script directly without needing to put it in a file. For example I have tried (obviously unsuccessfully):
    C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\ExtendScript Toolkit.exe -run "alert('Hello World');"
    Thanks!

    You might be looking for something like this: javascript - Is it possible to execute JSX scripts from outside ExtendScript? - Stack Overflow
    Although that one is about executing JSX files, the solutions given (Applescript as well as COM/VBScript) can be adapted to simply run a javascript code snippet rather than JSX file because the solutions simply call the Adobe app's Applescript/COM API to "execute javascript" (actually execute ExtendScript technically), and in the solution, they using includes to pull in the JSX file. You'd simply replace the include with actual javascript code snippet inserted in.
    Though this would then require you to run a VBScript, Applescript, or other script (that calls the COM/Applescript API) rather than the ESTK command line option.

  • How to insert a shoutbox and a counter in a flash file with html code?

    How to insert a shoutbox and a counter in a flash file with
    html code?
    Code shout box
    <!-- BEGIN MYSHOUTBOX.COM CODE -->
    <iframe src="
    http://489676.myshoutbox.com/"
    width="152" height="300" frameborder="0"
    allowTransparency="true"></iframe>
    <!-- END MYSHOUTBOX.COM CODE-->
    Code compteur
    <script type="text/javascript" src="
    http://www.123compteur.com/counterskinable01.php?votre_id=268303"></script><noscript><a
    href="
    http://www.123compteur.com"
    target="_blank">compteur</a></noscript>

    thx =D

Maybe you are looking for

  • Multiple reads of the same data from Multiprovider by Query (Bex)

    Hello, guys! We're having issue with performance of a query built on Multiprivider. During our investigation, we've found out that within one run of a Query, it several times refers to InfoProvider for the same data (see image attached). Do you have

  • Apple Lossless Tags won't Save

    Hi everyone, Has anyone experienced this? I have about 4 CDs that I've ripped in iTunes (I think), and they are all in Apple Lossless m4a. Despite the fact that their tags load just fine in other programs, iTunes is treating these files as if they ha

  • ITunes not using the defined proxy setting

    iTunes 10.0.1 on MacOS X 10.6.4 isn't correctly using the system proxy setting defined through:<pre>System Preferences- Network Advanced- Proxies Web proxy (HTTP) Web Proxy Server myproxy.my_company.mycountry : 3128</pre> For example, when selecting:

  • Create RESTful web service with CSV format (bug??)

    Hi All: I am using APEX 4.2.2 with APEX listener 2.0.2. I have create a RESTful web service to retreieve some data from a table. The format is "CSV" (the other option is JSON, which I am not faimilar with). then I tested and it generate with below sa

  • Retrieve plan list to insert it in report builder

    Hello, I'm using TFS2013 with Visual Studio 2013, Microsoft Test Manager (MTM) and Report Builder 3.0. I'd like to get the lists of tests planned in MTM and show it in a report (with other things). In Report Builder, I create a DataSet (DS_Suite), wh