the script at the bottom appends a text area with info onclick [URL] I wanted to know if it's possible to have a function (possible within the existing one?) that replaces text as well.
Something like this format would be perfect for what I'm tring to do:
<a href="#" onclick = "check('Replace this text', 'With this in the textarea')">Click Me to replace</a><br/>
Original Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
I have a problem to solve where I have a Hidden set of 40 text inputs. A link to show 10 more of these in inputs at a time, all having unique ID's. The goal I am trying to accomplish is to set the focus to say the 10th input. If the "show more inputs" link is clicked then the focus should go to the next 10th input (really input ID number 20) and so on.
I have the following code in a website which is the W3C method of loading XML/XSL via Javascript. The code works perfectly except as you can see from the last line of code it appends the fixed div. This is not suitable as I need the site to overwrite the contents of the fixed div (not append). How could I rewrite that last line of code so that the data within the fixed div is rewritten with the contents of resultDocument. innerHTML doesn't work since the content of resultDocument is an XML file.
how can i have the functionality of load() except i want to append data instead of replace. maybe i can use get() instead but i want to just extract the #posts element from the loaded data
This is probably something simple that I am not aware of, but when I use append to add a <div> containing a button the button does not work. I've tried to test the appended div with an alert but the results come back as null as if there is nothing there even though the new div is visible on the page. Looking at the page source there is no new div present. Does this have something to do with the appended div not being registered with the DOM?
I am at a stand still with trying to figure this out. I have a textarea, i would like to check for links entered by users and replace/remove the anchor attribute from the string. ie. change [URL] to website its more so to validate ( i have a php side working to validate for links but am trying to get jquery to just remove it and maybe say a warning.
I want to make a textarea appear onclick meant for editing. I want to use something similar to this: <a onclick="document.write('<textarea><?php echo $text; ?>
I'm trying to achieve something (which doesn't seem to difficult to me) but I can't get it to work. I want to embed video's through a swf-videoplayer on my website. The idea is that I have (say 750 * 400 px) images wrapped in links. The links point at the videofile. If the user clicks the link, I want to replace the link+image by the swf video with the same dimensions...
The javascript below is looking for the word 'margaret thatcher' in the body and surrounding it with a link. It's lower-case but the script is ignoring the case so that won't matter. But, the problem is that because Margaret Thatcher is a proper noun, it will be capitalized in the body text yet replaced with lower-case text. How can I modify this script to look for the word while ignoring the case but use the same text it found as the replacement instead of using the text object?
I am trying to append to a text node(which is contained in another element) a string but i canot. Here is the code-tell me please where is the error below because i cannot spot it.The containing element is a div class with name calendar, as you can see. Inside the calendar the current month is displayed(not shown here-which i get with the date object), i want to append to the month the test p.
My work website, [URL] has an activity search on the top-right side of the page that searches congregation details. It mostly works fine, except that if you search "greenwood" instead of getting shown Greenwood Uniting Church, it tells you that there are no congregations within 15km of Greenwood. Yet if you search "Kingsley" (Next suburb over, less than 15km from Greenwood) it finds the Greenwood Uniting Church.
We worked out that the issue is that there is more than one Greenwood in Australia, so it needs to be clarified that the state of WA needs to be added to the search. The easiest way (I feel) is to check whether WA has been included in the text, and if not, to add it to the search text. This is the code I've got so far (written by a friend, who wasn't certain whether it would work or not):
PHP Code: echo '<script type="text/javascript">'; // Check that there's state appended to the search echo 'function checkState(){'; echo 'var searchField=document.getElementById("suburb-address");'; echo 'if (searchField.value.lastindexOf("WA")==0) { '; echo 'searchField.value+=", WA";'; echo '}'; echo '}'; echo '</script>';
(It's included in a Wordpress Plugin, hence the echo tags)and the form itself: PHP Code: echo '<form method="post" action="http://'.$current_site->domain . $current_site->path.'home/activity-search" onSubmit="javascript:checkState();return true;">'; echo '<label>Suburb:</label><input type="text" name="address" id="suburb-address" title="Enter Suburb & State" />'; echo '<select name="categories[]" >'; echo '<option value ="">All Activities</option>'; $categories_list = split('[ ]', get_setting('categories', $db)); foreach ($categories_list AS $cat){ $cat = trim($cat); echo '<option>'.$cat.'</option>'; } echo '</select>'; echo '<label>Country:</label>'; echo '<select name="country" id="country">'; echo'<option>au</option>'; echo '</select>'; echo '<label>Radius:</label>'; echo '<select name="radius" id="radius">'; echo'<option>15</option>'; echo '</select>'; echo '<input type="submit" name="submit" value="Search" class="btn" />'; echo '</form>'; I'm wondering whether the if statement is valid, but I'm not knowledgeable in Javascript, so I don't know where to begin.
I am creating a small CMS module for a client. I created a little form and when they click Submit, it goes straight out into an include (.inc) file, which is connected to the web page to be displayed.
The trouble I am having is that I'd like to create an additional button that will insert some text (certain html tags to make their life easier, etc) - I got it to work, actually. The script executes and the text is inserted - but once the script runs and the page refreshes (or whatever it does), the text then disappears. The only way I can seem to get it to stay put is when I use "onmouseup" instead of "onclick" - which means that every time the user accidentally mouses over the thing, it inserts the text.
Is there a way to do this for a while. Say I have a dynamic page that generates some td elements. The syntax here is freemarker but you can easily envision your favorite serverside text generating language instead.
<table id="records"> <thead><th>Name</th></thead> <tbody> [#list records as record] <tr> <td class="trigger" id="trigger_${record.ID}" onclick="showDetails (${record.ID})">${record.name}</td> </tr> [/#list] </tbody> </table> <script type="text/javascript"> function showDetails(recordID) { // normally an ajax post but you get the idea window.location = '/record?recordID=' + recordID } </script>
Now I want to get that onclick out of there and bind it using jquery, but I haven't been able to figure out if there is a way to get the parameter there. Apart from putting it in some attribute and looking at it. Is there a cleaner way?
<script type="text/javascript"> $(document).ready(function() { $('#records td.trigger').click(function() { window.location = '/record?recordID=' + ??? how do i get that }); }); </script>
I know I could look at the elements attributes, something like this.attr("id").substring().etc().etc() .. but sometimes there are many parameters to the javascript fn to generate the post and that approach doesn't seem to viable. and there isn't really a standard attribute to use that makes sense for that anyway.
document.write will flush current document content. I've found I can use DOM to append some element to the document, but I think append html text directly is better. Is it possible to append html text to current document?
I have multiple poems [3 in this trial] (held as external .txt files containing <br> line breaks) that i wish to display at random on each site visit. I don't know how to load them into a specific 'div' area or (if necessary) assign them to a variable.
<script type="text/javascript"> var whichpoem=1+(Math.round(Math.random()*(2))); var group='/poem'+whichpoem+'.txt'; var client = new XMLHttpRequest(); client.open('GET', group); client.send(); $.get(group, function(data){ $("body").append(data); }); </script>
I am attempting to manipulate a long text string with javascript. This text string may have one or more occurrences of a string which starts with a particular string and ends with another string. So, for example, text that starts with 'nam' and ends with 'sit' in this example:
Lorem ipsum dolor sit amet, consectetur adipiscing elit nam aliquam leo sit amet nibh tincidunt ultricies. Nullam nam feugiat velit sit amet dui scelerisque id ornare nulla ultricies.
I want to prepend another string before the nam and append another after the sitt, to give me:
Lorem ipsum dolor sit amet, consectetur adipiscing elit before nam aliquam leo sit after amet nibh tincidunt ultricies. Nullam before nam feugiat velit sit after amet dui scelerisque id ornare nulla ultricies.
I think the way to do this is via RegExp, but I'm insufficiently familiar with this to know how to write the expression.
What I would like to do is create header and footer information for my webpages which are created by calling from a referenced .js page . . . for example in Header.js:
I am trying to find a way to add an extra piece of hidden text onto the end of the text a user enters into the form field so that when the form is sent the extra text will automatically be added to the end before sending. I have tried cobbling together different scripts using onblur/onclick etc but I just cannot get any to work as I need..
I need to replace the captions with simple text for download speed purposes. This is controlled by a piece of Javascript written for me. I need to change the caption image for a text one.
I have a div that contains simple text data with line breaks. I want to append a mailto link to the email address but so far I have not been able to select the email.
The container looks something like this:
My first intention was to use a filter like:
But I found out that I couldn't apply it since the container had no children. So I used a function first to wrap the elements into span tags and then applied 'find':
I am new to javascript, and am having an issue, which I'm sure is elementary.. I found a script for expandable content, it suffices fine. As it stands, the script toggles images onclick. For example, whence the menu is collapsed, it displays "plus.gif" next to it, and when the menu is expanded, it displays "minus.gif" next to it.
Basically, what I would like to know is, thus: how would I change it to display text icons next to it? For example, in place of "plus.gif" I should like it to display "+" as actual text. I've dredged a number of places, however, I've found nothing. Furthermore, I cannot figure out how to do it.