Ir para conteúdo
Fórum Script Brasil

Rafael Spilki

Veteranos
  • Total de itens

    1.583
  • Registro em

  • Última visita

Tudo que Rafael Spilki postou

  1. Cara... aí é que tá... porque não usa AJAX? Não vale a pena quebrar a cabeça com isso visto que em ajax a coisa tomará uma forma mais profissional e acima de tudo com uma maior cadência... Além disso tem codigos prontos lá no forum de ajax exatamente com o que você precisa... Da uma repensada aí... te garanto que vai valer a pena... Se quiser, sinalize sua vontade em tentar por AJAX que algum moderador move este tópico ara área adequada... ok? []'s
  2. Cara... de cabeça eu não lembro... mas amanha edito aqui pra você com a solução. Tenho isso no escritório. O que eu sei é que tem que setar a imagem logo após a criação do pdf... explico melhor amanhã... []'s
  3. Cara, você vai ter que usar operadores asp, tipo: + - / * (soma, subtrai, divide e multiplica), em alguns momentos pode ser necessário "splitar" esse numero para fazer a operação direitinho... no mais, conhecimentos gerais em geografia e matemática irão importar mais do que o próprio ASP... []'s
  4. É pessoal, parece que a tão primssiora "solução definitiva" para png transparente no IE6 não é tão definitiva assim... Resolvi a questão usando flash... ficou bem legal e funcionou... todo caso... fica aí o registro... Testei várias soluções para png com fundo transparente no IE6 e todas "bloqueiam" o "mapeamento" da imagem para linkagem da mesma... []'s
  5. Pessoal, tenho um imagem em png que para ficar com o fundo transparente estou usando uma classe, no entanto ela impede o funcionamento do mapeamento dessa imagem. Isso ocorre apenas no IE6, nos outros navegadores ficam perfeitos... Rola alguma dica? <img class="png_bg" src="biblio/rodape.png" alt="rodape" usemap="#Map1" style="border-width:0px;"> <map name="Map1" id="Map1"> <area shape="rect" coords="688,1,779,31" href="http://www.meudominio.com.br" alt="1"> <area shape="rect" coords="22,3,254,16" href="mailto:atendimento@meudominio.com.br" alt="2"> </map> O code da classe é meio grandinho mas segue abaixo: /** * DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>. * Author: Drew Diller * Email: drew.diller@gmail.com * URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/ * Version: 0.0.8a * Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license * * Example usage: * DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector * DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement **/ /* PLEASE READ: Absolutely everything in this script is SILLY. I know this. IE's rendering of certain pixels doesn't make sense, so neither does this code! */ var DD_belatedPNG = { ns: 'DD_belatedPNG', imgSize: {}, delay: 10, nodesFixed: 0, createVmlNameSpace: function () { /* enable VML */ if (document.namespaces && !document.namespaces[this.ns]) { document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml'); } }, createVmlStyleSheet: function () { /* style VML, enable behaviors */ /* Just in case lots of other developers have added lots of other stylesheets using document.createStyleSheet and hit the 31-limit mark, let's not use that method! further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx */ var screenStyleSheet, printStyleSheet; screenStyleSheet = document.createElement('style'); screenStyleSheet.setAttribute('media', 'screen'); document.documentElement.firstChild.insertBefore(screenStyleSheet, document.documentElement.firstChild.firstChild); if (screenStyleSheet.styleSheet) { screenStyleSheet = screenStyleSheet.styleSheet; screenStyleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}'); screenStyleSheet.addRule(this.ns + '\\:shape', 'position:absolute;'); screenStyleSheet.addRule('img.' + this.ns + '_sizeFinder', 'behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;'); /* large negative top value for avoiding vertical scrollbars for large images, suggested by James O'Brien, http://www.thanatopsic.org/hendrik/ */ this.screenStyleSheet = screenStyleSheet; /* Add a print-media stylesheet, for preventing VML artifacts from showing up in print (including preview). */ /* Thanks to Rémi Prévost for automating this! */ printStyleSheet = document.createElement('style'); printStyleSheet.setAttribute('media', 'print'); document.documentElement.firstChild.insertBefore(printStyleSheet, document.documentElement.firstChild.firstChild); printStyleSheet = printStyleSheet.styleSheet; printStyleSheet.addRule(this.ns + '\\:*', '{display: none !important;}'); printStyleSheet.addRule('img.' + this.ns + '_sizeFinder', '{display: none !important;}'); } }, readPropertyChange: function () { var el, display, v; el = event.srcElement; if (!el.vmlInitiated) { return; } if (event.propertyName.search('background') != -1 || event.propertyName.search('border') != -1) { DD_belatedPNG.applyVML(el); } if (event.propertyName == 'style.display') { display = (el.currentStyle.display == 'none') ? 'none' : 'block'; for (v in el.vml) { if (el.vml.hasOwnProperty(v)) { el.vml[v].shape.style.display = display; } } } if (event.propertyName.search('filter') != -1) { DD_belatedPNG.vmlOpacity(el); } }, vmlOpacity: function (el) { if (el.currentStyle.filter.search('lpha') != -1) { var trans = el.currentStyle.filter; trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100; el.vml.color.shape.style.filter = el.currentStyle.filter; /* complete guesswork */ el.vml.image.fill.opacity = trans; /* complete guesswork */ } }, handlePseudoHover: function (el) { setTimeout(function () { /* wouldn't work as intended without setTimeout */ DD_belatedPNG.applyVML(el); }, 1); }, /** * This is the method to use in a document. * @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container' **/ fix: function (selector) { if (this.screenStyleSheet) { var selectors, i; selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */ for (i=0; i<selectors.length; i++) { this.screenStyleSheet.addRule(selectors[i], 'behavior:expression(DD_belatedPNG.fixPng(this))'); /* seems to execute the function without adding it to the stylesheet - interesting... */ } } }, applyVML: function (el) { el.runtimeStyle.cssText = ''; this.vmlFill(el); this.vmlOffsets(el); this.vmlOpacity(el); if (el.isImg) { this.copyImageBorders(el); } }, attachHandlers: function (el) { var self, handlers, handler, moreForAs, a, h; self = this; handlers = {resize: 'vmlOffsets', move: 'vmlOffsets'}; if (el.nodeName == 'A') { moreForAs = {mouseleave: 'handlePseudoHover', mouseenter: 'handlePseudoHover', focus: 'handlePseudoHover', blur: 'handlePseudoHover'}; for (a in moreForAs) { if (moreForAs.hasOwnProperty(a)) { handlers[a] = moreForAs[a]; } } } for (h in handlers) { if (handlers.hasOwnProperty(h)) { handler = function () { self[handlers[h]](el); }; el.attachEvent('on' + h, handler); } } el.attachEvent('onpropertychange', this.readPropertyChange); }, giveLayout: function (el) { el.style.zoom = 1; if (el.currentStyle.position == 'static') { el.style.position = 'relative'; } }, copyImageBorders: function (el) { var styles, s; styles = {'borderStyle':true, 'borderWidth':true, 'borderColor':true}; for (s in styles) { if (styles.hasOwnProperty(s)) { el.vml.color.shape.style[s] = el.currentStyle[s]; } } }, vmlFill: function (el) { if (!el.currentStyle) { return; } else { var elStyle, noImg, lib, v, img, imgLoaded; elStyle = el.currentStyle; } for (v in el.vml) { if (el.vml.hasOwnProperty(v)) { el.vml[v].shape.style.zIndex = elStyle.zIndex; } } el.runtimeStyle.backgroundColor = ''; el.runtimeStyle.backgroundImage = ''; noImg = true; if (elStyle.backgroundImage != 'none' || el.isImg) { if (!el.isImg) { el.vmlBg = elStyle.backgroundImage; el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5); } else { el.vmlBg = el.src; } lib = this; if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */ img = document.createElement('img'); lib.imgSize[el.vmlBg] = img; img.className = lib.ns + '_sizeFinder'; img.runtimeStyle.cssText = 'behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */ imgLoaded = function () { this.width = this.offsetWidth; /* weird cache-busting requirement! */ this.height = this.offsetHeight; lib.vmlOffsets(el); }; img.attachEvent('onload', imgLoaded); img.src = el.vmlBg; img.removeAttribute('width'); img.removeAttribute('height'); document.body.insertBefore(img, document.body.firstChild); } el.vml.image.fill.src = el.vmlBg; noImg = false; } el.vml.image.fill.on = !noImg; el.vml.image.fill.color = 'none'; el.vml.color.shape.style.backgroundColor = elStyle.backgroundColor; el.runtimeStyle.backgroundImage = 'none'; el.runtimeStyle.backgroundColor = 'transparent'; }, /* IE can't figure out what do when the offsetLeft and the clientLeft add up to 1, and the VML ends up getting fuzzy... so we have to push/enlarge things by 1 pixel and then clip off the excess */ vmlOffsets: function (el) { var thisStyle, size, fudge, makeVisible, bg, bgR, dC, altC, b, c, v; thisStyle = el.currentStyle; size = {'W':el.clientWidth+1, 'H':el.clientHeight+1, 'w':this.imgSize[el.vmlBg].width, 'h':this.imgSize[el.vmlBg].height, 'L':el.offsetLeft, 'T':el.offsetTop, 'bLW':el.clientLeft, 'bTW':el.clientTop}; fudge = (size.L + size.bLW == 1) ? 1 : 0; /* vml shape, left, top, width, height, origin */ makeVisible = function (vml, l, t, w, h, o) { vml.coordsize = w+','+h; vml.coordorigin = o+','+o; vml.path = 'm0,0l'+w+',0l'+w+','+h+'l0,'+h+' xe'; vml.style.width = w + 'px'; vml.style.height = h + 'px'; vml.style.left = l + 'px'; vml.style.top = t + 'px'; }; makeVisible(el.vml.color.shape, (size.L + (el.isImg ? 0 : size.bLW)), (size.T + (el.isImg ? 0 : size.bTW)), (size.W-1), (size.H-1), 0); makeVisible(el.vml.image.shape, (size.L + size.bLW), (size.T + size.bTW), (size.W), (size.H), 1 ); bg = {'X':0, 'Y':0}; if (el.isImg) { bg.X = parseInt(thisStyle.paddingLeft, 10) + 1; bg.Y = parseInt(thisStyle.paddingTop, 10) + 1; } else { for (b in bg) { if (bg.hasOwnProperty(b)) { this.figurePercentage(bg, size, b, thisStyle['backgroundPosition'+b]); } } } el.vml.image.fill.position = (bg.X/size.W) + ',' + (bg.Y/size.H); bgR = thisStyle.backgroundRepeat; dC = {'T':1, 'R':size.W+fudge, 'B':size.H, 'L':1+fudge}; /* these are defaults for repeat of any kind */ altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'W'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'H'} }; if (bgR != 'repeat' || el.isImg) { c = {'T':(bg.Y), 'R':(bg.X+size.w), 'B':(bg.Y+size.h), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */ if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */ v = bgR.split('repeat-')[1].toUpperCase(); c[altC[v].b1] = 1; c[altC[v].b2] = size[altC[v].d]; } if (c.B > size.H) { c.B = size.H; } el.vml.image.shape.style.clip = 'rect('+c.T+'px '+(c.R+fudge)+'px '+c.B+'px '+(c.L+fudge)+'px)'; } else { el.vml.image.shape.style.clip = 'rect('+dC.T+'px '+dC.R+'px '+dC.B+'px '+dC.L+'px)'; } }, figurePercentage: function (bg, size, axis, position) { var horizontal, fraction; fraction = true; horizontal = (axis == 'X'); switch(position) { case 'left': case 'top': bg[axis] = 0; break; case 'center': bg[axis] = 0.5; break; case 'right': case 'bottom': bg[axis] = 1; break; default: if (position.search('%') != -1) { bg[axis] = parseInt(position, 10) / 100; } else { fraction = false; } } bg[axis] = Math.ceil( fraction ? ( (size[horizontal?'W': 'H'] * bg[axis]) - (size[horizontal?'w': 'h'] * bg[axis]) ) : parseInt(position, 10) ); if (bg[axis] % 2 === 0) { bg[axis]++; } return bg[axis]; }, fixPng: function (el) { el.style.behavior = 'none'; var lib, els, nodeStr, v, e; if (el.nodeName == 'BODY' || el.nodeName == 'TD' || el.nodeName == 'TR') { /* elements not supported yet */ return; } el.isImg = false; if (el.nodeName == 'IMG') { if(el.src.toLowerCase().search(/\.png$/) != -1) { el.isImg = true; el.style.visibility = 'hidden'; } else { return; } } else if (el.currentStyle.backgroundImage.toLowerCase().search('.png') == -1) { return; } lib = DD_belatedPNG; el.vml = {color: {}, image: {}}; els = {shape: {}, fill: {}}; for (v in el.vml) { if (el.vml.hasOwnProperty(v)) { for (e in els) { if (els.hasOwnProperty(e)) { nodeStr = lib.ns + ':' + e; el.vml[v][e] = document.createElement(nodeStr); } } el.vml[v].shape.stroked = false; el.vml[v].shape.appendChild(el.vml[v].fill); el.parentNode.insertBefore(el.vml[v].shape, el); } } el.vml.image.shape.fillcolor = 'none'; /* Don't show blank white shapeangle when waiting for image to load. */ el.vml.image.fill.type = 'tile'; /* Makes image show up. */ el.vml.color.fill.on = false; /* Actually going to apply vml element's style.backgroundColor, so hide the whiteness. */ lib.attachHandlers(el); lib.giveLayout(el); lib.giveLayout(el.offsetParent); el.vmlInitiated = true; lib.applyVML(el); /* Render! */ } }; try { document.execCommand("BackgroundImageCache", false, true); /* TredoSoft Multiple IE doesn't like this, so try{} it */ } catch(r) {} DD_belatedPNG.createVmlNameSpace(); DD_belatedPNG.createVmlStyleSheet(); []'s
  6. você sabe pelo menos a latitude inicial e a final e a longitude inicial e final? Se sim é facinho facinho... []'s
  7. Cara, seguinte: Isso tem como fazer com ASP? Tem, porém não é jogo! O legal é você fazer isso usando AJAX (ASP+JS), mas nesse caso a dúvida terá de ser sanada lá no fórum de AJAX, ok? Caso aceite essa sugestão, nos posicione neste tópico para algum moderador mover o mesmo para área adequada, ok? []'s
  8. Não vai rolar, por favor não insista mais e aguarde para caso alguém possa/queira postar algo para você. Enquanto isso volto a sugerir que vá ao google e inicie seus estudos baixando exemplos, tutoriais e etc. []'s Rafael Spilki
  9. Isso aí você vai resolver no forum de HTML / CSS usando colspan ou rowspan... aguarde algum moderador mover seu tópico pra área correta. []'s
  10. Rafael Spilki

    Formatar Hora

    Pra saber a diferença entre uma hora/data e outra use datediff... ex.: periodo = DateDiff("n", "18:30", "20:30") o codigo acima lhe dará a diferença em minutos entre as dois horários... []'s
  11. Cara, não é só uma questão de código e sim do que e como você vai querer trabalhar. Por exemplo: Quais as vantagens e desvantagens de se trabalhar com sessions? você sabe? Quais as vantagens e desvantagens de se trabalhar com cookies? você sabe? Então... você primeiro vai ter que dar uma pesquisada no google e conforme forem surgindo dúvidas mais específicas você vai postando em tópicos tb específicos. Um código pra isso que você quer eu não tenho pronto. Teria que criar do zero, desde o BD até os scripts... Mas com um pouco de estudo certamente você conseguirá, é fácil... []'s
  12. Fala Kuroi, concordo com você! Entre o formato brasileiro e o americano é melhor trabalhar com o americano e só na hora de imprimir em tela passar pro Brasileiro. No entanto tem uma outra forma que dá menos incomodação ainda e que passei a usar já há alguns anos: Eu não trabalho mais com campo no formato data e sim com tres campos no formato numero, ex.: CampoDDi = rs("CampoDDi") CampoMMi = rs("CampoMMi") CampoYYi = rs("CampoYYi") datai = CampoDDi &"/"& CampoMMi &"/"& CampoYYi Não tem erro... incomoda um pouquinho mais na hora de fazer querys (principalmente com between) mas no geral é bem mais fácil... []'s
  13. Acho que na query você terá de trabalhar com o formato americano de datas (mm/dd/yyyy) mesmo elas estando no formato brasileiro no BD. além disso, nunca esqueça que a sintaxe correta para se trabalhar com datas em qualquer query é: #"& (data) &"# ou seja: sql = "select * from sua tabela where campo_data >= #"& (var_data) &"# Testa aí e posta os resultados... []'s
  14. Essa é certamente a melhor solução por id de usuários ou nome de usuários. Para fazer isso você terá de trabalhar com cookies ou sessions... De uma pesquisada sobre isso no google. A lógica é assim: 1) o user faz login; 2) o id do user é armazenado em uma cookie ou session; 3) em todas as tabelas do id terá um campo chamado id_user ou grupo (bem indicado para fazer depois níveis de usário - recomendo já criar os dois campos); 4) Sempre que for fazer instruções de insert, delete ou update você usará o id_user o resgatando das cookies ou sessions para trabalhar o banco de dados. Pronto! a lógica é essa... agora mão a obra! []'s
  15. Saquei! Cara, isso daí vai ser uma mistura de asp com outras linguagens... Os arquivos.doc já conseguem ser abertos pela maioria dos navegadores modernos sem rolo, então você tem dois caminhos (pelo menos que vejo agora): 1) da um redirect simples pro seu arquivo .doc, ex.: paginateste.asp <% response.redirect "/imagem/aula.doc" %> 2) fazer a mesma coisa só que usando iframe ou div, nesse caso você poderá carregar o word em um espaço determinado do site... Bom, essas são pelo menos duas maneiras de resolver e por enquanto não vejo outras... se me lembrar de mais alguma posto aqui! []'s
  16. O que exatamente você está tentando fazer com essas datas? Qual o seu objetivo? Debuga esse select e posta aqui o resultado disso? []'s
  17. Normalmente o melhor é fazer isso no proprio select usando between... caso não seja possível aconselho usar a função cdate para formatar as datas e comparalas... ex.: datai = Cdate(month (datai) &"/"& day (datai) &"/"& year (datai)) dataf = Cdate(month (dataf) &"/"& day (dataf) &"/"& year (dataf)) if datai < dataf then '... end if []'s
  18. Uhm... acho que a sintaxe do update é outra: conexao.execute = "UPDATE nome_tabela SET nome_campo='"&nome_variavel&"' WHERE nome_campo2 = "& nome_campo 2 &"" Sacou? []'s
  19. Rafael Spilki

    Upload com Ajax

    Aparece alguma mensagem de erro? Qual? O que exatamente está acontecendo por aí? []'s
  20. Não entendi... Pode explicar um pouco melhor? []'s
  21. Rafael Spilki

    Erro ao realizar query

    Cara, eu sugiro duas coisas: 1) Procure resgatar os valores necessários para as query colocando-os em variáveis novas, ex.: cod_usuario = Clng('0'" & request.cookies("css")("coduser") Apropósito... é exatamente aqui onde ACHO que está o erro... mas para confirmar vamos ao item 2... 2) Faça sua query desta forma: cod_usuario = Clng('0'" & request.cookies("css")("coduser") ComandoSQL = "Select * from usuarios where cod_usuario = "&cod_usuario &" " Set rs = conexao.execute("ComandoSQL") Mas para descobrirmos o porque do erro vamos debugar a query antes de exceutá-la, assim: cod_usuario = Clng('0'" & request.cookies("css")("coduser") ComandoSQL = "Select * from usuarios where cod_usuario = "&cod_usuario &" " response.write ComandoSQL response.end Set rs = conexao.execute("ComandoSQL") Obs.: da forma acima estou tratando o campo cod_usuario como se fosse número, caso seja texto mude para cod_usuario = '"&cod_usuario &"'... Com essas informações acredito que ficará mais fácil descobrir o erro... caso você não consiga poste aqui as seguintes informações: a ) Resultado em tela do DEBUG; b ) Se o campo cod_usuario lá no BD está como número ou texto. []'s
  22. Legal... Funcionou aqui! Meus testes anteriores tavam uma real gambiarra! Acabei usando a solução do fercosmig... simplesinho e bem elegante! Muito obrigado pessoal. []'s Rafael Spilki
  23. Fala galera! Alguém sabe como pegar um status de um radiobutton sem a necessidade do click? Explico melhor: Uso uns radiobuttons que entre outras coisas oculta/mostra div's quando selecionados, só que quando o user entra na página pela primeira vez ou da um refresh já tem uma opção previamente marcada desse radiobutton e como a minha função é chamada no OnClick acaba que as div's só são mostradas quando o user clica novamente sobre a opção desejada. Tentei fazer aqui umas gambiarras usando o onload, mas como minha função funciona pelos status dos radiobuttons isso não funcionou direito. Alguém tem alguma sugestão? Segue o trecho do código (eu peguei essa função aqui do fórum mesmo): <script> function trocadivs(status){ if (status=="estagio"){ document.getElementById("div_estagio").style.display = ''; document.getElementById("div_emprego").style.display = 'none'; }else if (status=="emprego"){ document.getElementById("div_estagio").style.display = 'none'; document.getElementById("div_emprego").style.display = ''; }else if (status=="ambos"){ document.getElementById("div_estagio").style.display = ''; document.getElementById("div_emprego").style.display = ''; } } </script> <input name="emprego" type="radio" value="emprego" onclick="trocadivs(this.value)">Emprego <input name="emprego" type="radio" value="estagio" checked onclick="trocadivs(this.value)"> Est&aacute;gio <input name="emprego" type="radio" value="ambos" onclick="trocadivs(this.value)">Ambos <div id="div_emprego" style="display:none"> emprego / </div> <div id="div_estagio" style="display:none"> Estagio </div>
  24. Como programas, recomendo o DreamWeaver CS3 ou Superior... apesar de que ASP você opde programar inclusive no bloco de notas, mas o DW facilita bastante as coisas. Mas não confunda, sugiro o DW como editor mas em hipótese alguma sugiro que você use os códigos prontos do DW... são horríveis! Apostilas tem várias... sugiro o site www.criarweb.com que tem uma linguagem que na minha opinião é um pouco mais voltada pro iniciante, onde o do macoratti peca um pouco... []'s
  25. Grande Jonathan... Cara, tudo certinho por aqui, e com você? Na verdade eu não quero modificar idioma nenhum, quero apenas verificar qual o idioma do usuário que está acessando o site para dar um redirect automático, ou seja, no fim será uma condicional simples em asp mesmo do tipo: if idioma = "pt-br" then response.redirect ("index.asp") elseif idioma = "en" then response.redirect ("index_en.asp") 'elseif... '... end if Mas então, minha dificuldade é exatamente em descobrir o idioma do usuário... Usando variáveis do servidor isso não funciona como eu gostaria, por isso pensei em verificar o idioma pelo lado cliente e depois criar uma rotina em asp como o modelo acima. O que eu queria mesmo era conseguir definir um range de ip's para conseguir descobrir o que é ip americano, o que é ip brasileiro e assim por diante... mas depois de algumas horas de estudos acredito que isso não seja possível, ou pelo menos, certamente também não é 100% isento de erros, apesar de que acredito que seria a melhor forma... Enfim... Continuo estudando por aqui e se rolar mais alguma dica sempre ajuda!
×
×
  • Criar Novo...