document.getElementById("anchor-div").scrollIntoView();
Tips about programming, tips about software and web development in general and links to cool/useful tech sites
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
2014-08-05
Javascript: how to scroll automatically to a certain area of the page
Skeleton AJAX call with JQuery
var array_info = {}; array_info['key1'] = $("#field1").val(); array_info['key2'] = $("#field2").val(); var array_info_json = JSON.stringify(array_info); //ajax call $.ajax({ url: "file.php", type: "POST", data: { action: "parameter", field_data: array_info_json }, success: function (data) { console.log(data); if (data != '') { $('#div_container').html('Sucess'); dataArray = JSON.parse(data); } else{ alert('No data'); } }, error: function (a,b) { alert('Error'); } });
2006-03-27
Tools: Yahoo! UI Library
«The Yahoo! User Interface Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, HTML and AJAX. The UI Library Utilities facilitate the implementation of rich client-side features by enhancing and normalizing the developer's interface to important elements of the browser infrastructure (such as events, in-page HTTP requests and the DOM.»
More >
2005-12-29
Notes - Web: select all javascript function for checkboxes (multivalue too)
function selectAll(fieldname, bFlag) {
var checkField = document.forms[0].elements[fieldname];
if (checkField.length)
{
for (i=0; i<checkField.length; i++)
{
if (checkField[i].checked)
{
checkField[i].checked = bFlag;
}
}
}
else if (checkField.checked)
{
checkField.checked = bFlag;
}
}
2005-11-14
Notes - Web: bypassing the $$Return field
To avoid the processing of the $$Return field, save the document with the command:
@Command([FileSave])
If using Javascript then instead of using document.forms[0].submit(), create a button with the above formula and give it an id (ex:bt_save) and then on the submit script do:
document.all.bt_save.click()
The url of the document will be the original one (http://server_name//database_name/form_name?OpenForm), with "&Seq=1" (2,3,...) appended in the end.
Labels:
code,
javascript,
lotus notes,
submission,
tips
2005-11-11
Notes - Web: simulate notes client continue=false behaviour on web save
Form:
(Server_Name e Path_Info are CGI fields)
WebQuerySaveAgent:
(if the validation fails, then the doc will not be saved because of the SaveOptions field value)
Form - onload:
(optionally)
(Server_Name e Path_Info are CGI fields)
. field SaveOptions=0
. field $$Return= "[http://" + Server_Name + @Left(Path_Info;"nsf") + "nsf/0/"+ @Text(@DocumentUniqueID) + "?OpenDocument]"
WebQuerySaveAgent:
(if the validation fails, then the doc will not be saved because of the SaveOptions field value)
if (validateForm) doc.SaveOptions=1
Form - onload:
(optionally)
if (document.all.field_error.value!="") alert("Document not saved. \n Errors:" + document.all.field_error.value)
Labels:
code,
javascript,
lotus notes,
submission,
tips
2005-11-10
Web - Js: generic form validation function
function isSomethingSelected( obj ){
for (var r=0; r < obj.length; r++){
if ( obj[r].checked ) return true;
}
}
/*--- form validation--- */
function checkRequiredField(sFname)
{
field = self.document.getElementById(sFname);
sType = field.type.toLowerCase();
var bOk = true;
switch (sType)
{
case "text":
case "textarea" :
if (field.value=="") bOk=false;
break;
case "checkbox":
case "radio":
if ( !field[0]) { //handle single item group first
if ( !field.checked ) bOk=false;
}
else
{
if (!isSomethingSelected(field)) bOk=false;
}
break;
case "select-one":
if (field.selectedIndex == 0) bOk= false;
break;
case "select-multiple":
if (field.selectedIndex == -1) bOk=false;
break;
default:
break;
}
return bOk;
}
for (var r=0; r < obj.length; r++){
if ( obj[r].checked ) return true;
}
}
/*--- form validation--- */
function checkRequiredField(sFname)
{
field = self.document.getElementById(sFname);
sType = field.type.toLowerCase();
var bOk = true;
switch (sType)
{
case "text":
case "textarea" :
if (field.value=="") bOk=false;
break;
case "checkbox":
case "radio":
if ( !field[0]) { //handle single item group first
if ( !field.checked ) bOk=false;
}
else
{
if (!isSomethingSelected(field)) bOk=false;
}
break;
case "select-one":
if (field.selectedIndex == 0) bOk= false;
break;
case "select-multiple":
if (field.selectedIndex == -1) bOk=false;
break;
default:
break;
}
return bOk;
}
2005-11-09
Web - Js: including javascript stored in a separate file
<script type="text/javascript" src="/file_path/file_name.js"></script>
DOM: window.open
Gecko DOM Reference
Syntax
WindowObjectReference = window.open(strUrl, strWindowName [, strWindowFeatures]);
Subscribe to:
Posts (Atom)