Capturing URL That Is TYPED Into Address Bar
Oct 5, 2009
My client has a training site that is associated with 4 different domains. If a user navigates away from one of the domains to another site (for instance google or msn) they want to display a message and ask them if they want meant to leave the training site. my understanding of the window.location.href is that it will not capture what is typed into the address bar until the request is submitted to the server but by then they are leaving the site. below is my code on the onbeforeunload event. concept: i want to capture the URL, compare the hostname and if the host name is one of the 4 domains then allow them to proceed if it is not then as them if they want to leave the site. if they click ok allow them to move forward, if the click cancel then reload the page. I know this is considered bad design and i have expressed this but this how they want the site to behave.
<script type="text/javascript">
function SiteCheck()
{
var strCurrentURL = window.location.href;
var strNewHostName = strCurrentURL.split("/");
//
for(i = 0; i < strNewHostName.length; i++)
{
alert(i + ' ' + strNewHostName[i]);
}
[Code]...
View 1 Replies
ADVERTISEMENT
Oct 5, 2009
My client has a training site that is associated with 4 different domains. If a user navigates away from one of the domains to another site (for instance www.google.com) they want to display a message and ask them if they want to leave the training site. my understanding of the window.location.href is that it will capture what is typed into the address bar until the request is submitted to the server but by then they are leaving the site. below is my code on the onbeforeunload event. conceptually: i want to capture the URL, compare the hostname and if the host name is one of the 4 domains then allow them to proceed, if it is not then as them if they want to leave the site. if they click ok allow them to move forward, if the click cancel then reload the page. I know this is considered bad design and i have expressed this but this how they want the site to behave.
<script type="text/javascript">
function SiteCheck()
{
var strCurrentURL = window.location.href;
var strNewHostName = strCurrentURL.split("/");
//
for(i = 0; i < strNewHostName.length; i++)
{
[Code]....
View 4 Replies
View Related
Mar 16, 2011
i want to add the link address when clicked on the link in web page to the outlook express address book when the outlook window populates. i tried to put
<a href="mailto:enquiry@mydomain.com" > click here </a>
but it only add address to the To section of outlook window, i want it should store the address in the address book.. of outlook express..
View 1 Replies
View Related
Jul 14, 2010
I have been looking for a solution for a long time. I have embedded a SWF app in html page using SWFObject. Now I need to give the Flash app the address where it is currently embedded, since the same SWF file is embedded in more than one locations! So the Flash app is supposed to pull the right content according to its current position
View 9 Replies
View Related
Apr 8, 2011
I'm working on creating a custom calculator to determine the amount of money / credits users may earn from referrals. I've tested onChange, and it will work only when I have changed to a new field or clicked off that field. How do I make this calculate live?
So if the current value is 5 and I change it to 6, it will automatically recalculate the new value.
You can see what I'm working on here:
[URL]
Note: The one I'm testing is the 1st Level field. For now i'm just having it display the date.
View 6 Replies
View Related
May 25, 2010
I want a script that "types" my text letter by letter and also deletes the text letter by letter. I want it to look as if someone is typing the text live, and then when the start of the text deletes (letter by letter), it would start from the beginning, erasing the letters in the same pace new letters are being "typed". So this way you would never see the whole text, but only a bit of it at a time. By the time you would get to the end of the text, the beginning wouldn't be there. And I don't want the text in a box!
View 2 Replies
View Related
Oct 17, 2010
I am writing an HTML builder. On thing that I think would be helpful is if the user types in
="
A javascript adds another " for the user, but puts the cursor inbetween the two "'s. In other words, the javascript should assist users in writing HTML/Javascript codes. This may also be applied to < & >.
I have found this script that can get your position in a textarea. I also thought this might be of help:
Code:
var textarea = document.getElementById('code');
var tmp = textarea.value;
textarea.value = textarea.value.substring(0, textarea.selectionStart) + '"' + tmp + textarea.value.substring(textarea.selectionEnd);
Although I have tried, I have not been able to piece the scripts together.
View 1 Replies
View Related
Aug 12, 2009
My workplace has a lot of people doing manual entry. I'm looking to provide some friendly automatic formatting of data as they type it. I have working code (thus far) but I want to ensure I'm doing things in a sane way (there's a surprising amount you can do insanely that still works Here's a function below that transforms a phone number - the worker enters the digits(only), the field reflects (and could also accept) the fully formatted version (e.g. (123) 456-7890 ). I'm building this towards a plugin model (ala masked input with happy
[Code]...
View 3 Replies
View Related
Apr 11, 2011
I have a script that allows ONLY numbers to be typed into a text field. I have tried to modify this script to allow Decimals (periods) to be typed as well, but haven't succeeded. The code in Red are the changes I added to this script, but it isn't working out.
function numbersOnly(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 110 || charCode > 110))
return false;
return true;
}
Second Problem: I need to set a Minimum number users may type in the text field. Normally this would be a simple task, but the minimum number they may type is a decimal (0.10). The default value in the field is .50. I tried replacing the .50 with .09, and I can't get the field to run the script and set its new value to .10 (<- this is the minimum). Here is the code I am working with.
[Code]...
View 5 Replies
View Related
Aug 11, 2009
is there a way to determine whether a user clicked on a link vs typed in the url to get to a page? I'm trying to stop users from messing with GET forms (and i have to use them, POST wouldn't make sense in this case).
View 2 Replies
View Related
Mar 4, 2011
I think I have what is a simple question: I would like a checkbox to be checked if it is not already when a user types in the text area beside it. Form layout is demo'd below.
<table>
<tr>
<td><input type="checkbox" name="box[1]" value = "x"></td>
<td><textarea name="area[1]">
View 2 Replies
View Related
Apr 13, 2010
I'm trying to validate the text of an input as it is typed.I have this keyup:[code]The idea is that only let the user type a decimal number; and it does.The only problem is that it let type a dot [decimal separator I need] at the beginning; and I don't want that.I've been a while and searched Google for the Reg Exp, but had no luck.
View 4 Replies
View Related
Jul 25, 2009
i have got this great bit of code tha allows only numbers to be typed in the text box, how ddo i adjust this code to allow a . as well as the numbers.
[Code]....
View 4 Replies
View Related
Feb 15, 2010
I've a text box and a database table entry corresponding to the element. Now, I want to show suggestions as users keep on typing in the text box, the matching words from the database, similar to displaying friends as in facebook search.
View 2 Replies
View Related
Jul 15, 2011
I want to run a function when text is typed into an input field. So every time 1 character is put in it will process a function. However I do not know how to accomplish this. I tried the onchange attributed but that seems to only work when you unselect the input field.
how this might be accomplished? I'm also comfortable with jQuery if you think that's a better option.
View 2 Replies
View Related
Sep 11, 2009
Here's a script to check if there's typed in a message into a textarea (at least I think it is...) :
Code:
And here's the form :
Code:
View 3 Replies
View Related
Apr 24, 2009
my page allows the user to enter a number in a text box and a search request is sent to the server (if the user stops typing for 200ms) using AJAX. The following is the desired behavior.
(1)User starts typing a number in the text box. As the user is typing, no search requests are sent to the server.
(2)Once the user stops typing (i.e. no key events for 200 ms), use $.post() to execute a search.What is a good way to detect that the user hasn't typed anything for 200 ms?Is there anything in JQuery that I can use?
View 2 Replies
View Related
Jul 22, 2010
I'm creating a page that calculates a number depending on what value is inputted into a text field. I need to create some javascript that updates this new calculated value and outputs it next to the input field. Anytime the user changes the number, it recalculates the value. My calculation is currently being produced by PHP, however if I need to, I can create javascript as well to recalculate these numbers.
View 4 Replies
View Related
Jul 23, 2005
Is there any way to capture the action Ctrl+N (whether it in a hidden
button or keyword - doesn't matter) in html, javascript or php?
View 6 Replies
View Related
Nov 24, 2005
I'm trying to make my WYSIWYG editor cross-bowser compatible. To do this I'm contemplating a way to capture keystrokes, but have no clue to go about it.
For example:
If the user presses enter, I want to capture the keystroke and return a <br> tag or if the user presses ctrl + B, I want it to return a <strong> tag.
View 4 Replies
View Related
Jul 20, 2005
I'm sure you all have seen how using the src argument in a script tag
is essentially the same as including the body of the script within
your page. For example:
<script type="text/javascript"
src="http://somepage.com/somead/show_ads.js">
</script>
Is there a way to capture the html output of that script and save it
to a variable or text file so that I can use a language like php to
parse it and look for certain words or phrases?
For instance, this particular url executes some javascript code which
produces an iframe on my page, but view source only displays the
script tag. Using innerHTML I can get the iframe code to print in
another browser window, but I would prefer the iframe html be save to
a variable or text file so that I can write a script to parse it on
the fly.
View 1 Replies
View Related
Feb 20, 2009
my company has a bunch of web pages on which they want to record every DOM event(mouse movement, clicks etc), these pages were written in past and now with minimal editing I need to add listener to capture these events. way to do this (may be addition of eventlistener at Body tag to capture all bubbled up events, but i am not sure if it will work when stopPropagation method is called by some eventlistener in the chain). I am looking for a universal listener kind of thing that can be easily integrated with my pages.
View 1 Replies
View Related
Sep 10, 2011
I am new to this forum and also not a javascript coder. That said, I have a webpage that uses a freeware compiled javascript that displays the number of users current on line.
It works fine. But I would like to capture the output value as a variable that could then be used later. The code below displays the current number of users.
Code:
<script language="JavaScript" src="/cgi-bin/online/online.cgi?output=javascript"></script>
View 8 Replies
View Related
Jun 9, 2010
I have a very simple jquery RTE I've built. When adding a link I currently do this ( $.iframeread is just a function to pick the right way to "find" the iframe content for the browser being used)
[Code]....
I can obviously create this and show() it when I need to - what I don't know how to do is pass $('select[name="type"]').val() + $('input[name="link"]').val() back to the orginal function - ie how do I capture $link
[Code]...
View 2 Replies
View Related
Apr 15, 2010
I am using a third party shopping cart service written in php. I don't have access to the php code so I decided to use javascript to write a cookie. What I'm trying to do is have the cookie capture the referring URL and then keep it for a day and have it follow where ever the visitor goes in the shopping cart. Then when they check out, the referring URL will populate a form field and be returned as part of the form results. This way I can track where my visitors come from. My code is below and I'm adding it to the file designated as the head section. (The files I have access to must use some form of include but I can't use php in them - just html and javascript. I've tried.)
I have an alert in the code that suggests something to do as well as set the cookie. The alert comes up and the cookie is set but when you go to another page, the alert comes up again and another cookie is set. I just need to have it set once so when they fill out the order form, I'll know where they came from.
<SCRIPT LANGUAGE="JavaScript">
cookie_name = "dataCookie";
var referred;
[code]....
In the body I am reading it with a form field of
<SCRIPT LANGUAGE="javascript">
document.write("<FORM>")
document.write("Originally Referred by:")
[code]....
View 1 Replies
View Related
Aug 8, 2005
I've got a form that is enabling/disabling other fields based upon radio selections. I've got it all working, except with the form reset button. My "refresh" routine just iterates through the radio box to check which item is selected based upon e[i].checked state and enables/disables accordingly. Unfortunately it seems the reset event fires before the actual state of e[i] has been reset and my form enabing/disabling gets out of sync.
var btn = document.getElementById('formData');
formValidation.addEvent(btn, 'reset', formValidation.refreshUI, false);
refreshUI: function() {
var e = document.getElementsByTagName('input');
for (var i=0; i<e.length; i++) {
if (e[i].type == 'radio' && e[i].name == 'ipType' && e[i].id == 'ipStatic' && e[i].checked == true) {
document.getElementById('ipHost').disabled = false;
document.getElementById('ipAddress').disabled = false;
document.getElementById('ipMask').disabled = false;
document.getElementById('ipGateway').disabled = false;
break;
}
else if (e[i].type == 'radio' && e[i].name == 'ipType' && e[i].id == 'ipStatic' && e[i].checked == false) {
document.getElementById('ipHost').disabled = false;
document.getElementById('ipAddress').disabled = true;
document.getElementById('ipMask').disabled = true;
document.getElementById('ipGateway').disabled = false;
break;
}
}
}
View 1 Replies
View Related